<?php

	@include('include/common.inc.php');
	$query ="select * from $TBL_HOUSE where saveplan=2 and del=0  order by id desc";
	$cur_page = (int)$_GET["p"];   //获取当前页
	$url_param = preg_replace("/(p=[0-9]+)&/", "", $_SERVER['QUERY_STRING']);
	$pages = new Pager($query, $cur_page, 18, $url_param);
	$page_string = $pages -> getPageString();   
	$result = $pages -> getRsPerPage();
	$count = mysql_num_rows($result);
	while($rows = $db->fetch_array($result))
	{
        if($rows['hou_type']==1)
		{
			$rows['titlex'] ='租金';
		}elseif($rows['hou_type']==2){
			$rows['titlex'] ='賣價';
		}else{
			$rows['titlex'] ='賣價';
		}
		$rows['ADDR']=FSubstr(str_replace("&nbsp;","",strip_tags($rows[address])),0,26);
		$rows['TIT']=FSubstr(str_replace("&nbsp;","",strip_tags($rows[title])),0,26);
		$row1[]=$rows;
	}	
	//群活动
	$seld = "select * from $TBL_DEAL order by id asc";
    $resd = mysql_query($seld);
	while($row = mysql_fetch_array($resd))
	{
		if($row[id]==1)
		{
			$imgsection = $row[img];//活动
		}
		if($row[id]==3)
		{
			$imgzls = $row[img];//资料室
		}
		if($row[id]==4)
		{
			$text = $row[text];//跑马灯
		}
		if($row[id]==5)
		{
			$imgzz = $row[img];//跑马灯
		}	
	}
	
	//广告
	$seladv = "select * from $TBL_ADV order by id asc";
    $resadv = mysql_query($seladv);
	while($row = mysql_fetch_array($resadv))
	{
		$rowadv[] = $row;
	}
	if($count ==0)
	{
		$note = "對不起,沒有您要搜尋的房屋！";
	}
	$smarty->assign("imgzls",$imgzls);
	$smarty->assign("imgsection",$imgsection);
	$smarty->assign("row1",$row1);
	$smarty->assign("rowadv",$rowadv);
	$smarty->assign("text",$text);
	$smarty->assign("note",$note);
	@include('number.php');//验证码
	$smarty->assign("page_string",$page_string);
	$smarty->assign("mem_id",$_SESSION['mem_id']);
	$smarty->assign("type",$_SESSION['type']);
	$smarty->display('search.html');

?>